//前端用户模块业务逻辑接口
import http from "@/utils/http";

//用户注册
export function reg(user) {
    //这里是调用后端的真实接口。
    return http.post('/api/users/reg', user);
}

export async function checkIdentifyCanReg(identify) {
    let params = {
        identify: identify
    };
    return http.get('/api/users/checkIsReg', params);
}

export function login(identify, password) {
    let params = {
        identify: identify,
        password: password
    };
    return http.get('/api/users/auth', params);
}

export function logout(){
    return http.get('/api/users/logout');
}

export async function isLogin(){
    let date = new Date();
    return http.get('/api/users/isLogin?tm='+date.getTime());
}

export function updateUserProfile(user){
    return http.put('/api/users/update',user);
}

export function queryUserProfile(uid){
    let params={
        uid: uid
    };
    return http.get('/api/users/profile',params);
}